package br.ufal.tci.nexos.arcolive.command;

import java.util.Hashtable;

public class ArCoLIVECommandRepository {

	private Hashtable commands;
	private static ArCoLIVECommandRepository singleton;
	
	private ArCoLIVECommandRepository() {
		this.commands = new Hashtable();
	}
	
	public static ArCoLIVECommandRepository getInstance() {
		if (singleton == null) {
			singleton = new ArCoLIVECommandRepository();
		}
		return singleton;
	}
	
	public void addCommand(String name, ArCoLIVEClientCommand command) {
		this.commands.put(name, command);
	}
	
	public ArCoLIVEClientCommand getCommand(String name) {
		return (ArCoLIVEClientCommand) this.commands.get(name);
	}
	
	public boolean isCommandStored(String name) {
		return this.commands.containsKey(name);
	}
	
}
